package com.loong.ems.service.impl;

import com.loong.ems.domain.entity.Employee;
import com.loong.ems.domain.entity.SysUser;
import com.loong.ems.mapper.EmployeeMapper;
import com.loong.ems.mapper.SysUserMapper;
import com.loong.ems.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 龙勇-229970722
 * @date 2025-01-02 11:42
 * @description: 用户服务接口
 */

@Service
public class SysUserServiceImpl implements SysUserService {
    @Autowired
    private SysUserMapper sysUserMapper;

    /**
     * 获取用户列表
     * @return
     */
    @Override
    public List<SysUser> list() {
        return sysUserMapper.selectList();
    }

    /**
     * 根据用户名查询用户信息
     * @return
     */
    @Override
    public SysUser findUserByName(String username) {
        return sysUserMapper.findUserByName(username);
    }

    @Override
    public void save(SysUser user) {
        sysUserMapper.insert(user);
    }

    /**
     * 获取部长列表
     * @return
     */
    @Override
    public List<SysUser> findUserByRole() {
        return sysUserMapper.findUserByRole("user");
    }
}
